import {
  addrole, editrole, addgroup,
  editgroup, addarea, editarea, addclassify,
  editclassify, addpayment_cycle, editpayment_cycle,
  addpayment, editpayment, user, adduser, edituser,
  addstore, editstore, department, rolemenu
} from '@/services/basic';

const UserModel = {
  namespace: 'basic',
  state: {
    currentUser: {},
  },
  effects: {
    *department({ payload }, { call, put }) {
      const response = yield call(department, payload);
      return response
    },
    *rolemenu({ payload }, { call, put }) {
      const response = yield call(rolemenu, payload);
      return response
    },
    *addpayment({ payload }, { call, put }) {
      const response = yield call(addpayment, payload);
      return response
    },
    *editpayment({ payload }, { call, put }) {
      const response = yield call(editpayment, payload);
      return response
    },
    *addpayment_cycle({ payload }, { call, put }) {
      const response = yield call(addpayment_cycle, payload);
      return response
    },
    *editpayment_cycle({ payload }, { call, put }) {
      const response = yield call(editpayment_cycle, payload);
      return response
    },
    *addclassify({ payload }, { call, put }) {
      const response = yield call(addclassify, payload);
      return response
    },
    *editclassify({ payload }, { call, put }) {
      const response = yield call(editclassify, payload);
      return response
    },
    *addarea({ payload }, { call, put }) {
      const response = yield call(addarea, payload);
      return response
    },
    *editarea({ payload }, { call, put }) {
      const response = yield call(editarea, payload);
      return response
    },
    *addgroup({ payload }, { call, put }) {
      const response = yield call(addgroup, payload);
      return response
    },
    *editgroup({ payload }, { call, put }) {
      const response = yield call(editgroup, payload);
      return response
    },
    *addrole({ payload }, { call, put }) {
      const response = yield call(addrole, payload);
      return response
    },
    *editrole({ payload }, { call, put }) {
      const response = yield call(editrole, payload);
      return response
    },
    *adduser({ payload }, { call, put }) {
      const response = yield call(adduser, payload);
      return response
    },
    *edituser({ payload }, { call, put }) {
      const response = yield call(edituser, payload);
      return response
    },
    *addstore({ payload }, { call, put }) {
      const response = yield call(addstore, payload);
      return response
    },
    *editstore({ payload }, { call, put }) {
      const response = yield call(editstore, payload);
      return response
    },
    *user({ payload }, { call, put }) {
      const response = yield call(user, payload);
      return response
    },

  },
  reducers: {
    saveCurrentUser(state, action) {
      return { ...state, ...action.payload };
    }
  },
};
export default UserModel;
